﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using VietThuongLMS;
using VietThuongLMS.Utils;
namespace VietThuongLMS.Areas.Admin.Models
{
    public class ChuongTrinhKhuyenMaiModel
    {
        public int Delete { get; set; }
        public int ID { get; set; }
        public string TenChuongTrinh { get; set; }
        public int GiamGia { get; set; }
        public int MaLoaiLopHoc { get; set; }
        public string NgayBatDau { get; set; }
        public string NgayKetThuc { get; set; }
        
        public ChuongTrinhKhuyenMai ChuyenDoiModel()
        {
            ChuongTrinhKhuyenMai ctkm = new ChuongTrinhKhuyenMai();
            ctkm.TenChuongTrinh = TenChuongTrinh;
            ctkm.GiamGia = GiamGia;
            ctkm.MaLoaiLopHoc = MaLoaiLopHoc;
            Converter cter = new Converter();
            ctkm.NgayBatDau = cter.StringToDate(NgayBatDau);
            ctkm.NgayKetThuc = cter.StringToDate(NgayKetThuc);
            ctkm.Deleted = Delete;
            ctkm.ID = ID;
            return ctkm;
        }
        public ChuongTrinhKhuyenMaiModel() { }
        public ChuongTrinhKhuyenMaiModel(ChuongTrinhKhuyenMai ctkm)
        {
            ID = ctkm.ID;
            Delete = (int)ctkm.Deleted;
            TenChuongTrinh = ctkm.TenChuongTrinh;
            GiamGia = (int)ctkm.GiamGia;
            MaLoaiLopHoc = (int)ctkm.MaLoaiLopHoc;
            NgayKetThuc = ctkm.NgayKetThuc.Value.ToString("dd/MM/yyyy");
            NgayBatDau = ctkm.NgayBatDau.Value.ToString("dd/MM/yyyy");
            
        }
    }
}